#ifndef _QUANTUM_VIEW_H__
#define _QUANTUM_VIEW_H__

#include "buffer.h"
#include "layout/layout_manager.h"
#include "utils/gapbuffer/gapbuffer.h"
#include "typedefines/rect.h"
#include <memory>
#include <ncursesw/ncurses.h>
#include <vector>

class Window;
class View {
  protected:
	std::shared_ptr<WINDOW> _window;
	Window* _parent;
	std::vector<std::shared_ptr<Buffer>> _buffers;
	std::shared_ptr<Buffer> _active_buffer;

	// auto alloc window
	Rect _window_rect;

  public:
	View(Window* parent, const Rect& rect,
		 std::shared_ptr<Buffer> buffer = nullptr);
	std::shared_ptr<Buffer> get_active_buffer();
	void reset(const Rect& rect);
	Rect get_window_rect() const { return _window_rect; }
	virtual void update();
	virtual void key_input(const type::input_type& ch) { _active_buffer->gap_buffer.PutChar(ch); }
	~View(){};
};

#endif // _QUANTUM_VIEW_H__
